home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / Miro_Downloader.exe / gtcache.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2007-11-12  |  1.5 KB  |  53 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.5)
  3.  
  4. import gettext as _gt
  5. import locale
  6. import config
  7. import prefs
  8. import platformutils
  9. import os
  10. _gtcache = None
  11.  
  12. def init():
  13.     global _gtcache
  14.     _gtcache = { }
  15.     if not platformutils.localeInitialized:
  16.         raise Exception, 'locale not initialized'
  17.     
  18.     locale.setlocale(locale.LC_ALL, '')
  19.     _gt.bindtextdomain('miro', config.get(prefs.GETTEXT_PATHNAME))
  20.     _gt.textdomain('miro')
  21.     _gt.bind_textdomain_codeset('miro', 'UTF-8')
  22.  
  23.  
  24. def gettext(text):
  25.     text = text.encode('utf-8')
  26.     
  27.     try:
  28.         return _gtcache[text]
  29.     except KeyError:
  30.         out = _gt.gettext(text).decode('utf-8')
  31.         _gtcache[text] = out
  32.         return out
  33.     except TypeError:
  34.         print 'DTV: WARNING: gettext not initialized for string "%s"' % text
  35.         import traceback
  36.         traceback.print_stack()
  37.         return text
  38.  
  39.  
  40.  
  41. def ngettext(text1, text2, count):
  42.     text1 = text1.encode('utf-8')
  43.     text2 = text2.encode('utf-8')
  44.     
  45.     try:
  46.         return _gtcache[(text1, text2, count)]
  47.     except:
  48.         out = _gt.ngettext(text1, text2, count).decode('utf-8')
  49.         _gtcache[(text1, text2, count)] = out
  50.         return out
  51.  
  52.  
  53.